<template>
  <div>
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :md="6" :sm="8">
            <a-form-item :label="$t('m.system.httpconfig.entity.httpName')">
              <a-input placeholder="" v-model="queryParam.httpName$lk"></a-input>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <a-form-item :label="$t('m.system.httpconfig.entity.httpCode')">
              <a-input placeholder="" v-model="queryParam.httpCode$lk"></a-input>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">{{ $t('m.common.button.query') }}</a-button>
              <a-button type="default" @click="searchReset" icon="reload" style="margin-left: 8px">{{ $t('m.common.button.reset') }}</a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <a-table
      ref="table"
      size="middle"
      bordered
      :rowKey="rowKey"
      :columns="columns"
      :dataSource="dataSource"
      :pagination="ipagination"
      :loading="loading"
      :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: (radio ? 'radio' : 'checkbox')}"
      @change="handleTableChange"
      :customRow="clickThenCheck"
    >
      <template slot="serialNum" slot-scope="text,record,index">
        {{ (ipagination.current - 1) * ipagination.pageSize + parseInt(index) + 1 }}
      </template>
    </a-table>
  </div>
</template>

<script>

import {YcListMixin} from '@/mixins/YcListMixin'
import YchConstant from '@/api/YchConstant'

export default {
  name: 'ActAppHttpViewList',
  mixins: [YcListMixin],
  props: {
    radio: Boolean,
    // 预留
    groupId: {
      type: String,
      required: true
    },
    httpMethod: String,
  },
  data() {
    return {
      queryParam: {
        httpMethod: this.httpMethod || undefined
      },
      columns: [
        {
          title:this.$t('m.common.label.number'),
          dataIndex: '',
          key: 'rowIndex',
          width: 50,
          align: "center",
          scopedSlots: {customRender: 'serialNum'},
        },
        {
          title: this.$t('m.system.httpconfig.entity.httpName'),
          dataIndex: 'httpName',
          align: 'center',
        },
        {
          title: this.$t('m.system.httpconfig.entity.httpCode'),
          dataIndex: 'httpCode',
          align: 'center',
        },
        {
          title: this.$t('m.system.httpconfig.entity.httpUrl'),
          dataIndex: 'httpUrl',
          align: 'center',
        },
        {
          title: this.$t('m.system.httpconfig.entity.httpMethod'),
          dataIndex: 'httpMethod',
          align: 'center',
        },
        // {
        //   title: this.$t('m.system.httpconfig.entity.inParameterType'),
        //   dataIndex: 'inParameterType',
        //   align: 'center',
        // },
        // {
        //   title: this.$t('m.common.label.sort'),
        //   dataIndex: 'orderBy',
        //   align: 'center',
        // }
      ],
      url: {
        list: YchConstant.PREFIX_EFORM +"/manage/actAppHttp/list",
      }
    }
  },
  methods: {},
}
</script>
